	include monitor\monitor.inc
	include keyboard\keyboard.inc
	include file\file.inc
	
EXIT macro
	;; quitProgram
	mov ax, 4C00h
	int 21h
endm
	
	.model small,c
	
	.stack 64
	.data
WinBuf1	dw 512 dup(0)
Window1	WindowStruct <,,,,,,offset WinBuf1>
VideoData VideoStruct <>
	
fileHandle dw ?
fileBuffer db 16+1 dup(0)
testFile db "TEST.TXT",0
	
myMsg	db " 8765:4321 "
	db " 0011 2233 4455 6677 8899 AABB CCDD EEFF "
	db " 0123456789ABCDEF "
	db "        ",0
		
	.code
main proc
	mov	ax, @data
	mov	ds, ax
	invoke v_getparams, offset VideoData
	call drawWindow
;;; printMsg
	invoke v_putstring, offset MyMsg, offset VideoData, X_MIN+1, 1, (BLUE shl 4) +RED	
;	invoke v_putstring, offset MyMsg, offset VideoData, X_MAX-1, 1, BLUE
;;; videoFunc TEST
;	SET_CURSORSIZE CURSOR_MIN, CURSOR_MAX
;	GOTO_CURSOR X_MIN+10, Y_MIN+10
	WAITKEY
	GOTO_CURSOR X_MAX/2, Y_MAX/2
	
	;; openFile
	invoke dosOpenFile, offset testFile, O_RDWR
	mov	fileHandle, ax
	
	;; firstRead
	invoke dosSeekFile, fileHandle, 0, 0
	invoke dosReadFile, fileHandle, offset fileBuffer, 16
	;invoke dosWriteFile, fileHandle, offset fileBuffer, 6
	invoke v_putstring, offset fileBuffer, offset VideoData, X_MIN+2, Y_MIN+54, RED
	
	;; secondRead
	invoke dosSeekFile, fileHandle, 0, 16
	invoke dosReadFile, fileHandle, offset fileBuffer, 16
	;invoke dosWriteFile, fileHandle, offset fileBuffer, 6
	invoke v_putstring, offset fileBuffer, offset VideoData, X_MIN+3, Y_MIN+54, RED	
	WAITKEY
	
	EXIT
main endp

drawWindow proc
	;; drawWindow
	mov	si, offset Window1
	mov	[si].WindowStruct.X1, X_MIN
	mov	[si].WindowStruct.Y1, Y_MIN
	mov	[si].WindowStruct.X2, X_MAX
	mov	[si].WindowStruct.Y2, Y_MAX
	mov	[si].WindowStruct.BorderAttribute, RED
	mov	[si].WindowStruct.TextAttribute, BLUE
	invoke v_winDraw, offset VideoData, offset Window1
	ret
drawWindow endp
end main
